package com.edu.exam.enums.assessment.generation;

import com.edu.exam.enums.core.BaseEnum;

/**
 * 配置类型枚举
 *
 * @author 系统生成
 * @version 2.0
 * @since 2025-11-09
 */
public enum ConfigType implements BaseEnum {
    BATCH_GENERATION("BATCH_GENERATION", "批量生成配置"),
    AUTO_GENERATION("AUTO_GENERATION", "自动生成配置"),
    TEMPLATE_GENERATION("TEMPLATE_GENERATION", "模板生成配置"),
    IMPORT_GENERATION("IMPORT_GENERATION", "导入生成配置"),
    CUSTOM_GENERATION("CUSTOM_GENERATION", "自定义生成配置");

    private final String code;
    private final String description;

    ConfigType(String code, String description) {
        this.code = code;
        this.description = description;
    }

    @Override
    public String getCode() {
        return code;
    }

    @Override
    public String getDescription() {
        return description;
    }

    public static ConfigType fromCode(String code) {
        for (ConfigType type : values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        throw new IllegalArgumentException("Unknown config type code: " + code);
    }

    @Override
    public String toString() {
        return code + " - " + description;
    }
}